'\" et
.TH FUSER "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
fuser
\(em list process IDs of all processes that have one or more files open
.SH SYNOPSIS
.LP
.nf
fuser \fB[\fR-cfu\fB] \fIfile\fR...
.fi
.SH DESCRIPTION
The
.IR fuser
utility shall write to standard output the process IDs of processes
running on the local system that have one or more named files open.
For block special devices, all processes using any file on that device
are listed.
.P
The
.IR fuser
utility shall write to standard error additional information about the
named files indicating how the file is being used.
.P
Any output for processes running on remote systems that have a named
file open is unspecified.
.P
A user may need appropriate privileges to invoke the
.IR fuser
utility.
.SH OPTIONS
The
.IR fuser
utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
.IR "Section 12.2" ", " "Utility Syntax Guidelines".
.P
The following options shall be supported:
.IP "\fB\-c\fR" 10
The file is treated as a mount point and the utility shall report
on any files open in the file system.
.IP "\fB\-f\fR" 10
The report shall be only for the named files.
.IP "\fB\-u\fR" 10
The user name, in parentheses, associated with each process ID written
to standard output shall be written to standard error.
.SH OPERANDS
The following operand shall be supported:
.IP "\fIfile\fP" 10
A pathname on which the file or file system is to be reported.
.SH STDIN
Not used.
.SH "INPUT FILES"
The user database.
.SH "ENVIRONMENT VARIABLES"
The following environment variables shall affect the execution of
.IR fuser :
.IP "\fILANG\fP" 10
Provide a default value for the internationalization variables that are
unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
.IR "Section 8.2" ", " "Internationalization Variables"
for the precedence of internationalization variables used to determine
the values of locale categories.)
.IP "\fILC_ALL\fP" 10
If set to a non-empty string value, override the values of all the
other internationalization variables.
.IP "\fILC_CTYPE\fP" 10
Determine the locale for the interpretation of sequences of bytes of
text data as characters (for example, single-byte as opposed to
multi-byte characters in arguments).
.IP "\fILC_MESSAGES\fP" 10
.br
Determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard error.
.IP "\fINLSPATH\fP" 10
Determine the location of message catalogs for the processing of
.IR LC_MESSAGES .
.SH "ASYNCHRONOUS EVENTS"
Default.
.SH STDOUT
The
.IR fuser
utility shall write the process ID for each process using each file
given as an operand to standard output in the following format:
.sp
.RS 4
.nf

"%d", <\fIprocess_id\fR>
.fi
.P
.RE
.SH STDERR
The
.IR fuser
utility shall write diagnostic messages to standard error.
.P
The
.IR fuser
utility also shall write the following to standard error:
.IP " *" 4
The pathname of each named file is written followed immediately by a
<colon>.
.IP " *" 4
For each process ID written to standard output, the character
.BR 'c' 
shall be written to standard error if the process is using the file as
its current directory and the character
.BR 'r' 
shall be written to standard error if the process is using the file as
its root directory. Implementations may write other alphabetic
characters to indicate other uses of files.
.IP " *" 4
When the
.BR \-u
option is specified, characters indicating the use of the file shall be
followed immediately by the user name, in parentheses, corresponding to
the real user ID of the process. If the user name cannot be resolved from
the real user ID of the process, the real user ID of the process shall
be written instead of the user name.
.P
When standard output and standard error are directed to the same file,
the output shall be interleaved so that the filename appears at the
start of each line, followed by the process ID and characters
indicating the use of the file. Then, if the
.BR \-u
option is specified, the user name or user ID for each process using
that file shall be written.
.P
A
<newline>
shall be written to standard error after the last output
described above for each
.IR file
operand.
.SH "OUTPUT FILES"
None.
.SH "EXTENDED DESCRIPTION"
None.
.SH "EXIT STATUS"
The following exit values shall be returned:
.IP "\00" 6
Successful completion.
.IP >0 6
An error occurred.
.SH "CONSEQUENCES OF ERRORS"
Default.
.LP
.IR "The following sections are informative."
.SH "APPLICATION USAGE"
None.
.SH EXAMPLES
The command:
.sp
.RS 4
.nf

fuser -fu .
.fi
.P
.RE
.P
writes to standard output the process IDs of processes that are using
the current directory and writes to standard error an indication of how
those processes are using the directory and the user names associated
with the processes that are using the current directory.
.sp
.RS 4
.nf

fuser -c <\fImount point\fR>
.fi
.P
.RE
.P
writes to standard output the process IDs of processes that are using
any file in the file system which is mounted on <\fImount point\fR>
and writes to standard error an indication of how those processes are
using the files.
.sp
.RS 4
.nf

fuser <\fImount point\fR>
.fi
.P
.RE
.P
writes to standard output the process IDs of processes that are using
the file which is named by <\fImount point\fR> and writes to standard
error an indication of how those processes are using the file.
.sp
.RS 4
.nf

fuser <\fIblock device\fR>
.fi
.P
.RE
.P
writes to standard output the process IDs of processes that are using
any file which is on the device named by <\fIblock device\fR> and
writes to standard error an indication of how those processes are using
the file.
.sp
.RS 4
.nf

fuser -f <\fIblock device\fR>
.fi
.P
.RE
.P
writes to standard output the process IDs of processes that are using
the file <\fIblock device\fR> itself and writes to standard error an
indication of how those processes are using the file.
.SH RATIONALE
The definition of the
.IR fuser
utility follows existing practice.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
The Base Definitions volume of POSIX.1\(hy2017,
.IR "Chapter 8" ", " "Environment Variables",
.IR "Section 12.2" ", " "Utility Syntax Guidelines"
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
